const mutations = {
  // 改变城市列表cityList的值
  getCityList(state, payload) {
    state.cityList = payload.result;
    state.hotCityList = payload.result.splice(0, 1);
    state.cityList = payload.result;
    state.indexList = [];
    payload.result.forEach((element) => {
      state.indexList.push(element.prefix);
    });
  },

  // 点击事件选择城市改变城市名称
  changeCityName(state, payload) {
    state.cityName = payload.name;
    state.cityId = payload.id;
    localStorage.setItem("cityName", payload.name);
    localStorage.setItem("cityId", payload.id);
  },
};

export default mutations;
